package com.example.votes.service;

import com.example.votes.entity.Image;
import com.example.votes.repository.ImageRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ImageService {
    private final ImageRepository repo;
    public ImageService(ImageRepository repo) { this.repo = repo; }
    public List<Image> listSortedByVotesDesc() {
        return repo.findAllByOrderByVoteCountDesc();
    }
}